package com.joysuch.wwyt.bp.controller;


import com.joysuch.wwyt.bp.entity.bean.AlarmMessageBean;
import com.joysuch.wwyt.bp.service.AlarmMessageService;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.core.enums.Status;
import com.joysuch.wwyt.core.exception.ApiBusinessException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zr
 * @since 2021-12-09
 */
@RestController
@RequestMapping("/api/alarm-message")
@Api(tags = "接入报警信息")
public class AIAlarmMessageController {
    
    @Autowired 
    private AlarmMessageService alarmMessageService;
    
    @PostMapping("/saveAlarmMessage")
    @ApiOperation(value = "保存报警信息")
    private ResultBean saveOrUpdateAlarmMessage(@RequestBody AlarmMessageBean bean){
        try {
            alarmMessageService.saveOrUpdateAlarm(bean);
        } catch (ApiBusinessException e) {
            return ResultBean.fail(Status.AI_PUSH_FAILED);
        }
        return ResultBean.defaultSuccessResult();
    }
}

